
let data;

// 在浏览器控制台直接运行的代码
(async function() {
  try {
    // 打开数据库连接
    const openRequest = indexedDB.open('deepseek-chat', 1);
    
    // 等待数据库打开完成
    const db = await new Promise((resolve, reject) => {
      openRequest.onsuccess = () => resolve(openRequest.result);
      openRequest.onerror = () => reject(openRequest.error);
    });

    // 创建事务并获取对象仓库
    const transaction = db.transaction('history-message', 'readonly');
    const store = transaction.objectStore('history-message');
    
    // 通过主键获取 id=1 的数据
    const request = store.get('311b5ab0-dfd8-4505-89ad-30ec32a6422f');
    
    // 处理结果
    const result = await new Promise((resolve, reject) => {
      request.onsuccess = () => resolve(request.result);
      request.onerror = () => reject(request.error);
    });
    
    // 输出结果
    if (result) {
      console.log('成功获取用户数据:');
      console.log(JSON.stringify(result, null, 2));
    } else {
      console.log('未找到 ID=1 的用户');
    }
    
  } catch (error) {
    console.error('操作失败:', error);
  }
})();